﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sunny.UI;
namespace OtherDevice
{
    [Description("测高")]
    public partial class Form_Ethernet测高 : Form_ControlBase
    {
        public Form_Ethernet测高()
        {
            InitializeComponent();
        }
        Laser_TcpIpBase laser = null;
        public override void FlushToDlg(object devicebase)
        {
            try
            {
                if (devicebase == null)
                    return;
                this.laser = devicebase as Laser_TcpIpBase;
                this.Dock = DockStyle.Fill;
                this.Show();
            }
            catch (Exception)
            {

            }

        }

        private void btn_开始测高_Click(object sender, EventArgs e)
        {
            timer1.Interval = 50;
            timer1.Start();
        }

        private void btn_停止测高_Click(object sender, EventArgs e)
        {
            timer1.Stop();

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                double value = 0;
                laser.Get(1,100,ref value);
                lbl_测高值.Text = $"测高值:{value.ToString("0.000")}";
            }
            catch (Exception)
            {

            }
        }
    }
}
